package com.ssy.lingxi.member.merchant.controller.paas;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.api.model.vo.paas.MenuButtonDeleteVO;
import com.ssy.lingxi.member.merchant.api.model.vo.paas.MenuButtonVO;
import com.ssy.lingxi.member.merchant.service.paas.IPaasMenuService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 系统初始化 - 平台菜单管理
 * @author 万宁
 * @version 2.0.0
 * @date 2020-06-13
 */
@RestController
@RequestMapping("/paas/menu")
public class MenuController {
    @Resource
    private IPaasMenuService menuService;

    /**
     * 新增菜单
     * @param addVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public Wrapper<Void> addMenu(@RequestBody @Valid MenuButtonVO addVO) {
        return menuService.addMenu(addVO);
    }

    /**
     * 修改菜单
     * @param updateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Wrapper<Void> updateMenu(@RequestBody @Valid MenuButtonVO updateVO) {
        return menuService.updateMenu(updateVO);
    }

    /**
     * 删除菜单
     * @param menuVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public Wrapper<Void> deleteMenu(@RequestBody @Valid MenuButtonDeleteVO menuVO) {
        return menuService.deleteMenu(menuVO);
    }
}
